package com.zhaopin.mianshi;

import java.util.Objects;

/**
 * @author yin.peide
 * @date 2021-05-31 17:29
 * 单例模式
 */
public class Singleton1 {

    private Singleton1() {
    }

    private volatile static Singleton1 singleton1 = new Singleton1();

    public static Singleton1 getSingleton1() {
        if (Objects.isNull(singleton1)) {
            synchronized (Singleton1.class) {
                if (Objects.isNull(singleton1)) {
                    return new Singleton1();
                }
            }

        }
        return singleton1;
    }


}
